package edu.unh.sustain;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

public class UNHSustainabilityActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button transportation = (Button) findViewById(R.id.transportation);
        transportation.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent myIntent = new Intent(view.getContext(), TransportationActivity.class);
                startActivityForResult(myIntent, 0);
            }
        });
        
        Button socialMedia = (Button) findViewById(R.id.social_media);
        socialMedia.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View view) {
        		Intent myIntent = new Intent(view.getContext(), SocialMediaActivity.class);
        		startActivityForResult(myIntent, 0);
        	}
        });
        
        Button energyData = (Button) findViewById(R.id.energy_data);
        energyData.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View view) {
        		Intent myIntent = new Intent(view.getContext(), UtilMenuActivity.class);
        		startActivityForResult(myIntent, 0);
        	}
        });
    }
    
    /**
	 * On back button, exit app
	 */
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event)
	{
	    if (keyCode == KeyEvent.KEYCODE_BACK)
	    {
	    	finish( );
	        return true;
	    }
	    
	    return super.onKeyDown(keyCode, event);
	}
}